package com.thinvent.nj.ais.entity;


import com.thinvent.nj.mybatis.entity.BaseOracleEntity;

/**
 * 资源实体
 * @author liupeijun
 */
public class Resource extends BaseOracleEntity {

    public Resource() {}

    public Resource(String id) {
        setId(id);
    }

    // 资源名称
    private String name;

    // 父级资源ID
    private String pId;

    // 资源类型（1：菜单；2：操作）
    private String type;

    // 资源URI
    private String uri;

    // shiro 权限字符串
    private String permission;

    //是否启用
    private Boolean enabled = true;

    // 项目编号
    private String projectNo;

    // 排序
    private Integer sort;


    // 备注
    private String remarks;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getPId() {
        return pId;
    }

    public void setPId(String pId) {
        this.pId = pId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public String getProjectNo() {
        return projectNo;
    }

    public void setProjectNo(String projectNo) {
        this.projectNo = projectNo;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Resource resource = (Resource) o;

        if (!name.equals(resource.name)) {
            return false;
        }
        if (!pId.equals(resource.pId)) {
            return false;
        }

        if (uri != null ? !uri.equals(resource.uri) : resource.uri != null) {
            return false;
        }

        return permission != null ? permission.equals(resource.permission) : resource.permission == null;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + pId.hashCode();
        result = 31 * result + (uri != null ? uri.hashCode() : 0);
        result = 31 * result + (permission != null ? permission.hashCode() : 0);
        return result;
    }
}
